/**
 * Project Name:dsrs-businessservice-domain
 * File Name:ConsumerLogPo.java
 * Package Name:com.bwda.dsrs.businessservice.domain.vo.fileeditgrantsetting;
 * Date:2019年4月28日
 * Copyright (c) 2019, 江苏保旺达软件有限公司 All Rights Reserved.
 *
 */
package com.bwda.dsrs.filecenter.domain.vo.fileeditgrantsetting;

import com.bwda.dsrs.filecenter.domain.BusinessConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 文件编辑授权
 *
 * @author liangjianyong
 * @date 2019/4/12
 */
@Data
@ApiModel(description = "文件编辑授权")
public class FileEditGrantSettingVo {

    @ApiModelProperty(value = "主键ID")
    private Integer id;

    @ApiModelProperty(value = "组织名称/用户名称")
    private String name;

    @ApiModelProperty(value = "上级组织名称/所属组织")
    private String parentName;

    @ApiModelProperty(value = "用户编号")
    private String userCode;

    @ApiModelProperty(value = "只读/编辑权限 0:只读 1：编辑")
    private Integer readonlyEditRight;

    @ApiModelProperty(value = "复制权限  0：禁止  1:允许")
    private Integer copyRight;

    @ApiModelProperty(value = "另存为权限 0：禁止  1:允许")
    private Integer saveAsRight;

    @ApiModelProperty(value = "打印权限  0：禁止  1:允许")
    private Integer printRight;

    @ApiModelProperty(value = "0全局1个人2组织3自定义组")
    private Integer userType;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "状态  0:正常 1:禁用")
    private Integer status;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "0未删除 1已删除")
    private Integer delFlag;

    /**
     * 获取权限
     * @return
     */
    public String getRightStr(){
        StringBuilder sb=new StringBuilder();
        //0:只读 1：编辑
        if(BusinessConstants.OnlineEditRight.YES==getReadonlyEditRight()){
            //编辑
            sb.append(BusinessConstants.OnlineEditRightDescript.EDIT_RIGHT_STR);
            sb.append(BusinessConstants.OnlineEditRightDescript.DESCRIPT_STR_SPLIT);
        }else{
            //只读
            sb.append(BusinessConstants.OnlineEditRightDescript.READ_ONLY_RIGHT_STR);
            sb.append(BusinessConstants.OnlineEditRightDescript.DESCRIPT_STR_SPLIT);
            if(BusinessConstants.OnlineEditRight.NO==getCopyRight()){
                sb.append(BusinessConstants.OnlineEditRightDescript.NO_COPY_RIGHT_STR);
                sb.append(BusinessConstants.OnlineEditRightDescript.DESCRIPT_STR_SPLIT);
            }
        }
        //另存为
        if(BusinessConstants.OnlineEditRight.NO==getSaveAsRight()){
            sb.append(BusinessConstants.OnlineEditRightDescript.NO_SAVE_AS_RIGHT_STR);
            sb.append(BusinessConstants.OnlineEditRightDescript.DESCRIPT_STR_SPLIT);
        }
        //打印
        if(BusinessConstants.OnlineEditRight.NO==getPrintRight()){
            sb.append(BusinessConstants.OnlineEditRightDescript.NO_PRINT_RIGHT_STR);
        }
        return sb.toString();
    }

}
